package com.dog.basics.api.controller.common;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dog.basics.bean.dto.admin.common.CommonProblemSelectDto;
import com.dog.basics.bean.vo.admin.sys.CommonProblemDetailVo;
import com.dog.basics.bean.vo.api.common.CommonProblemAppPageVo;
import com.dog.basics.common.constant.SwaggerConstants;
import com.dog.basics.common.util.PageParam;
import com.dog.basics.common.util.R;
import com.dog.basics.service.common.ISysCommonProblemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;

/**
 * <p>
 * 常见问题 前端控制器
 * </p>
 *
 * @author fengjukang
 * @since 2019-10-11
 */
@RestController
@Api(value = "常见问题", tags = SwaggerConstants.API_ALL)
@RequestMapping("/api/common/problem")
@AllArgsConstructor
@ApiIgnore
public class ApiCommonProblemController {

    private final ISysCommonProblemService isyscommonproblemservice;


    /**
     * 常见问题列表
     *
     * @param page
     * @param dto
     * @return
     * @author guonh
     */
    @ApiOperation(value = "常见问题列表", notes = "常见问题列表", tags = SwaggerConstants.API_MY)
    @GetMapping("/page")
    public R<IPage<CommonProblemAppPageVo>> getCommonProblemPageList(PageParam page,CommonProblemSelectDto dto) {
        return R.ok(isyscommonproblemservice.getCommonProblemPageList(page, dto));
    }

    /**
     * 常见问题详情
     *
     * @param id
     * @return
     * @author guonh
     */
    @ApiOperation(value = "常见问题详情", notes = "常见问题详情", tags = SwaggerConstants.API_MY)
    @ApiImplicitParam(name = "id",value = "常见问题标识", dataType = "Long",required = true)
    @GetMapping("/info/{id}")
    public R<CommonProblemDetailVo> getCommonProblemDetail(@PathVariable("id") Long id) {
        return R.ok(isyscommonproblemservice.getCommonProblemDetail(id));
    }


}
